package jf.jextn.converter;

public abstract class NumberConverter<O extends Number> implements StringValueConverter<O> {
    protected int radix = 10;

    public NumberConverter() {
    }

    public void setRadix(int radix) {
        this.radix = radix;
    }

    @Override
    public O from(String value) {
        return from(value, radix);
    }

    protected abstract O from(String value, int radix);

    protected abstract String to(O value, int radix);

    @Override
    public String to(O o) {
        return o == null ? null : to(o, radix);
    }

}
